home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the 3D Game Programming Gurus / gurus.iso / DirectX / dx9sdkcp.exe / SDK (C++) / Bin / DXUtils / Visual Studio 6.0 Wizards / DMToolWizard.awx / TEMPLATE / PARAM.H < prev    next >
Encoding:
C/C++ Source or Header  |  2002-12-11  |  4.9 KB  |  105 lines

  1. //------------------------------------------------------------------------------
  2. // File: Param.h
  3. //
  4. // Desc: DirectMusicTool Wizard generated code - definitions of CCurveItem,
  5. //         CCurveList, and CParamsManager classes.
  6. //
  7. // Copyright (c) Microsoft Corporation.  All rights reserved.
  8. //------------------------------------------------------------------------------
  9.  
  10. #ifndef __TOOLPARAM_H__
  11. #define __TOOLPARAM_H__
  12.  
  13. #include "medparam.h"
  14. #include "alist.h"
  15.  
  16. typedef struct _ParamInfo
  17. {
  18.     DWORD dwIndex;                      // Which parameter.
  19.     MP_PARAMINFO    MParamInfo;         // Standard MediaParams structure.
  20.     WCHAR *         pwchText;           // Array of text names for enumerated types.
  21. } ParamInfo;
  22.  
  23. class CCurveItem : public AListItem
  24. {
  25. public:
  26.     CCurveItem* GetNext() { return (CCurveItem*)AListItem::GetNext();}
  27.     MP_ENVELOPE_SEGMENT m_Envelope;     // Envelope segment.
  28. };
  29.  
  30. class CCurveList : public AList
  31. {
  32. public:
  33.     void AddHead(CCurveItem* pCurveItem) { AList::AddHead((AListItem*)pCurveItem);}
  34.     CCurveItem* GetHead(){return (CCurveItem*)AList::GetHead();}
  35.     CCurveItem* RemoveHead(){ return (CCurveItem*)AList::RemoveHead();}
  36.     ~CCurveList();
  37. };
  38.  
  39. #define MAX_REF_TIME    0x7FFFFFFFFFFFFFFF
  40. #define MP_CAPS_ALL     MP_CAPS_CURVE_JUMP | MP_CAPS_CURVE_LINEAR | MP_CAPS_CURVE_SQUARE | MP_CAPS_CURVE_INVSQUARE | MP_CAPS_CURVE_SINE
  41.  
  42. class CParamsManager :  public IMediaParams, public IMediaParamInfo
  43. {
  44. public:
  45.     CParamsManager();
  46.     ~CParamsManager();
  47.  
  48.     // IUnknown
  49.     STDMETHOD(QueryInterface)(REFIID, LPVOID FAR *) PURE;
  50.     STDMETHOD_(ULONG, AddRef)() PURE;
  51.     STDMETHOD_(ULONG, Release)() PURE;
  52.  
  53.     // IMediaParams
  54.     STDMETHODIMP GetParam(DWORD dwParamIndex, MP_DATA *pValue);
  55.     STDMETHODIMP SetParam(DWORD dwParamIndex,MP_DATA value);
  56.     STDMETHODIMP AddEnvelope(DWORD dwParamIndex,DWORD cPoints,MP_ENVELOPE_SEGMENT *ppEnvelope);
  57.     STDMETHODIMP FlushEnvelope( DWORD dwParamIndex,REFERENCE_TIME refTimeStart,REFERENCE_TIME refTimeEnd);
  58.     STDMETHODIMP SetTimeFormat( GUID guidTimeFormat,MP_TIMEDATA mpTimeData);
  59.  
  60.     // IMediaParamInfo
  61.     STDMETHODIMP GetParamCount(DWORD *pdwParams);
  62.     STDMETHODIMP GetParamInfo(DWORD dwParamIndex,MP_PARAMINFO *pInfo);
  63.     STDMETHODIMP GetParamText(DWORD dwParamIndex,WCHAR **ppwchText);
  64.     STDMETHODIMP GetNumTimeFormats(DWORD *pdwNumTimeFormats);
  65.     STDMETHODIMP GetSupportedTimeFormat(DWORD dwFormatIndex,GUID *pguidTimeFormat);        
  66.     STDMETHODIMP GetCurrentTimeFormat( GUID *pguidTimeFormat,MP_TIMEDATA *pTimeData);
  67.  
  68.     // other (non-COM) functions
  69.     HRESULT InitParams(DWORD cTimeFormats, const GUID *pguidTimeFormats, DWORD dwFormatIndex, MP_TIMEDATA mptdTimeData, DWORD cParams, ParamInfo *pParamInfos);
  70.     HRESULT GetParamFloat(DWORD dwParamIndex,REFERENCE_TIME rtTime,float *pval); // returns S_FALSE if rtTime is after the end time of the last curve
  71.     HRESULT GetParamInt(DWORD dwParamIndex,REFERENCE_TIME rt,long *pval); // returns S_FALSE if rtTime is after the end time of the last curve
  72.     HRESULT CopyParamsFromSource(CParamsManager * pSource);
  73.  
  74.     // parameter control curve handling
  75.     class UpdateCallback
  76.     {
  77.     public:
  78.         // Define this in derived classes if you are going to use UpdateActiveParams.
  79.         //  Called by CParamsManager inside UpdateActiveParams to update the effect's internal state variables.
  80.         //  SetParamUpdate should be the same as SetParam, except that DMO defer the call to the base class
  81.         //  (CParamsManager::SetParam) in SetParam but should not do so in SetParamUpdate.
  82.         virtual HRESULT SetParamUpdate(DWORD dwParamIndex, MP_DATA value) = 0;
  83.     };
  84.     // function that calls SetParam to adjust the value of all parameters that may have changed to their
  85.     // new values at time rtTime
  86.     void UpdateActiveParams(REFERENCE_TIME rtTime, UpdateCallback &rThis); // rThis should be the derived class (*this)
  87.     DWORD GetActiveParamBits() { return m_dwActiveBits; }
  88.  
  89. protected:
  90.     // data
  91.  
  92.     CRITICAL_SECTION m_ParamsCriticalSection;
  93.     BOOL            m_fDirty;                    // Has data changed since last file load or save?
  94.     DWORD           m_cTimeFormats;             // Number of supported time formats.
  95.     GUID            *m_pguidTimeFormats;        // Array of supported time formats.
  96.     GUID            m_guidCurrentTimeFormat;    // The time format we're set to.
  97.     MP_TIMEDATA     m_mptdCurrentTimeData;        // The unit of measure for the current time format.
  98.     DWORD           m_cParams;                  // Number of parameters.
  99.     ParamInfo       *m_pParamInfos;             // Array of ParamInfo structures, one for each parameter.
  100.     CCurveList      *m_pCurveLists;             // Array of Curve lists, one for each parameter.
  101.     DWORD           m_dwActiveBits;             // Tracks the params that currently have curves active.
  102. };
  103.  
  104. #endif // __TOOLPARAM_H__
  105.